package com.zhixing.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhixing.common.domain.vo.DriverInfoVO;
import com.zhixing.user.domain.entity.Driver;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface DriverMapper extends BaseMapper<Driver> {

    @Select("select u.avatar driver_avatar, d.name driver_name, d.car_brand, d.car_color, d.plate_number " +
            "from t_driver d left join t_user u on d.user_id = u.id where d.id = #{driverId}")
    DriverInfoVO getDriverInfo(Integer driverId);

    @Select("select user_id from t_driver where id = #{driverId}")
    Integer getUserIdByDriverId(Integer driverId);
}
